package org.hhchat.leetcode.tree;

import org.hhchat.leetcode.dataStruct.TreeNode;

/**
 * Created this one by HMH on 2017/10/3.
 */
public class code226_easy {
    static class Solution {
        public TreeNode invertTree(TreeNode root) {
            reverse(root);
            return root;
        }

        public void reverse(TreeNode root) {
            if (root == null) {
                return;
            }

            reverse(root.left);
            reverse(root.right);

            TreeNode temp = root.left;
            root.left = root.right;
            root.right = temp;
        }
    }
    public static void main(String[] args){

    }

}
